using System.Linq;
using UnityEngine;
using UnityEngine.UI;

namespace MaterialUI
{
	public class MaterialSliderInstantiationHelper : InstantiationHelper
	{
		public const int optionDiscrete = 0;

		public const int optionHasIcon = 1;

		public const int optionHasLabel = 2;

		public const int optionHasTextField = 3;

		public const int optionHasInputField = 4;

		[SerializeField]
		private MaterialSlider m_MaterialSlider;

		[SerializeField]
		private Slider m_Slider;

		[SerializeField]
		private GameObject m_LeftLabel;

		[SerializeField]
		private GameObject m_LeftIcon;

		[SerializeField]
		private GameObject m_RightLabel;

		[SerializeField]
		private GameObject m_RightInputField;

		[SerializeField]
		private GameObject m_LeftContent;

		[SerializeField]
		private GameObject m_RightContent;

		public override void HelpInstantiate(int[] options)
		{
			bool flag = true;
			bool flag2 = true;
			if (options.Contains(0))
			{
				m_Slider.wholeNumbers = true;
			}
			if (!options.Contains(1))
			{
				UnityEngine.Object.DestroyImmediate(m_LeftIcon);
			}
			else
			{
				flag = false;
			}
			if (!options.Contains(2))
			{
				UnityEngine.Object.DestroyImmediate(m_LeftLabel);
			}
			else
			{
				flag = false;
			}
			if (!options.Contains(3))
			{
				UnityEngine.Object.DestroyImmediate(m_RightLabel);
				m_MaterialSlider.valueText = null;
			}
			else
			{
				flag2 = false;
			}
			if (!options.Contains(4))
			{
				UnityEngine.Object.DestroyImmediate(m_RightInputField);
				m_MaterialSlider.inputField = null;
			}
			else
			{
				flag2 = false;
				m_MaterialSlider.lowRightDisabledOpacity = false;
			}
			if (flag)
			{
				UnityEngine.Object.DestroyImmediate(m_LeftContent);
			}
			if (flag2)
			{
				UnityEngine.Object.DestroyImmediate(m_RightContent);
			}
			if (base.transform.parent.GetComponent<ILayoutController>() != null)
			{
				m_MaterialSlider.hasManualPreferredWidth = true;
				m_MaterialSlider.manualPreferredWidth = 200f;
			}
			m_MaterialSlider.SetLayoutHorizontal();
			base.HelpInstantiate(options);
		}
	}
}
